package com.server.dao;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.DriverManager;


public class GenericDAO {
    
String url = "jdbc:mysql://127.0.0.1:8889/Projeto_TPA2";
String username = "root";
String password = "root";
private Connection conn;

    public Connection getConnection(){
     
        try{
        Class.forName("com.mysql.jdbc.Driver");
        
        this.conn = DriverManager.getConnection(url, username, password);
          return conn;
        }catch(ClassNotFoundException cnf){
            cnf.printStackTrace();
        }
        catch(SQLException sqlex){
            sqlex.printStackTrace();
        }
        
       return null; 
        
    }
    
    
    public Statement createStatement(){
        
        try{
            return this.conn.createStatement();
            
        }catch(SQLException sqlex){
            sqlex.printStackTrace();
        }
     
        return null;
    }
    
    
}
